﻿using System;
using Autodesk.Revit.DB;
using YArchitech.Revit.RevitExtension;

namespace YJKOpeningCommon.ProvideData2TrackDim
{
	public class DimData
	{
		public DimData(Line line, ReferenceArray arRef)
		{
			this.m_line = line;
			this.m_arRef = arRef;
		}

		public void CreateDim(Autodesk.Revit.DB.Document doc, DimensionType dimType)
		{
			Transaction transaction = new Transaction(doc, "CreateDimension");
			try
			{
				transaction.Start();
				RevitDimensionExtension.ResetDimTextPos(doc.Create.NewDimension(doc.ActiveView, this.m_line, this.m_arRef, dimType));
				transaction.Commit();
			}
			catch (Exception)
			{
				throw;
			}
		}

		private Line m_line;

		private ReferenceArray m_arRef;
	}
}
